package com.zenaprod.zenda.bag;

import com.zenaprod.zenda.config.Config;

import java.awt.*;

public class BoxView {
    private int x, y;
    private int width, height;
    private Box model;
    private BagView bagView;

    public BoxView(Box model, BagView bagView) {
        this.model = model;
        this.bagView = bagView;
        Config config = Config.getInstance();
        this.width = config.boxWidth;
        this.height = config.boxHeight;

        this.x = bagView.getX() + (model.getColumn() + 1) * config.bagPadding + model.getColumn() * config.boxWidth;
        this.y = bagView.getY() + (model.getRow() + 1) * config.bagPadding + model.getRow() * config.boxHeight;

        System.out.println("x: " + x + ", y: " + y + ", width: " + width + ", height: " + height);
    }


    public void draw(Graphics2D g2D) {
        g2D.drawRect(x, y, width, height);
    }

    public int getWidth() {
        return width;
    }

    public int getHeight() {
        return height;
    }
}
